#include "../../core/base/timer.h"
#include <stdio.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>

double GetSystemElapsedTime()
{
	struct timeval v;
	gettimeofday(&v,0);
	return double(v.tv_sec) + double(v.tv_usec / 1000000.0);
}

void KTimer::Start()
{
	mStartTime = GetSystemElapsedTime();
}

double KTimer::Stop()
{
	double current = GetSystemElapsedTime();
	double res = current - mStartTime;
	mStartTime = current;
	return res;
}